package com.example.stitch;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBManager extends SQLiteOpenHelper{
	private static final String DATABASE_NAME = "xstitch.db";
	private static final int DATABASE_VERSION = 1;
	
	private static final String DATABASE_CREATE =
		"Create table stitchtable" +
		"(stitch_name text not null, " +
		"widthLattice integer not null, " +
		"heightLattice integer not null, " +
		"thread_cnt integer not null, " +
		"stitch_rate integer not null, " +
		"stitch_date text not null, " +
		"primary key(stitch_name) ); ";
	
	private String DROP_TABLE =
		"drop table stitchtable;";
	
	public DBManager(Context context){
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(DATABASE_CREATE);
	}
	
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL(DROP_TABLE);
	}
}
